﻿/*****************************************************************************
 *  Copyright (C), 2015-2016, Mogoson tech. Co., Ltd.
 *  FileName: GameObjectExtention.cs
 *  Author: Mogoson   Version: 1.0   Date: 2015/09/03
 *  Version Description:
 *    Internal develop version,mainly to achieve its function.
 *  File Description:
 *    Extention GameObject class's functions.
 *  Class List:
 *    <ID>           <name>             <description>
 *     1.     GameObjectExtention    Extend GameObject's functions.
 *  Function List:
 *    <class ID>     <name>             <description>
 *     1.  
 *  History:
 *    <ID>    <author>      <time>      <version>      <description>
 *     1.     Mogoson     2015/09/03       1.0        Build this file
 *****************************************************************************/

namespace Developer.GameObjec
{
	using UnityEngine;

    /// <summary>
	/// Extend GameObject's functions.
	/// </summary>
	public static class GameObjectExtention
	{
		#region Public Static Method
		/// <summary>
        /// Set layer includ it's children.
        /// </summary>
		public static void BroadcastLayer(this GameObject gameObject, int layer)
		{
			gameObject.layer = layer;
            foreach (Transform trans in gameObject.transform)
            {
                BroadcastLayer(trans.gameObject, layer);
            }
        }//Bro...()_end
        #endregion
    }//class_end
}//namespace_end